import java.util.Scanner;

public class Practice {
    public static void main(String[] args) {
        //字符串 --- 用户登录
        String rightUsername = "zhangsan";
        String rightPassword = "123456";

        Scanner sc = new Scanner(System.in);
        for (int i = 3; i > 0; i--) {
            System.out.println("请输入用户名:");
            String username = sc.next();
            System.out.println("请输入密码:");
            String password = sc.next();

            if(username.equals(rightUsername) && password.equals(rightPassword)) {
                System.out.println("用户登录成功");
                break;
            } else {
                if(i == 1) {
                    System.out.println("账号" + username + "已被锁定,请联系客服小姐姐:xxx - xxxx");
                } else{
                    System.out.println("用户登录失败,账号和密码有误,您还有" + (i - 1) + "次机会");
                }
            }

        }




    }

}
